<?php
/*
 * name: cxm
 * desc: 广告位表
 * date: 2019/10/23
 * */
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class CreateAdvTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('adv', function (Blueprint $table) {
            $table->increments('id')->unsigned();
            $table->integer('position_id')->comment('广告位');
            $table->string('title')->comment('广告标题');
            $table->tinyInteger('type')->default(1)->comment('跳转方式 1链接跳转2参数跳转');
            $table->integer('info_id')->comment('跳转ID');
            $table->integer('images')->comment('图片地址');
            $table->string('url')->comment('跳转链接');
            $table->timestamp('start_time')->nullable()->comment('有效期-开始时间');
            $table->timestamp('end_time')->nullable()->comment('有效期-结束时间');
            $table->tinyInteger('status')->default(1)->comment('状态 1可用2不可用');
            $table->integer('sort')->default(1)->comment('排序');
            $table->timestamps();
            $table->softDeletes();
        });
        // 表注释
        DB::statement("ALTER TABLE `".config('database.connections.mysql.prefix')."adv` comment'广告表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('adv');
    }
}
